// 抽象类：被abstract修饰的类
public abstract class Shape {
    // 抽象方法：被abstract修饰的方法，没有方法体
    abstract public void draw();

    abstract void calcArea();

    public Shape(double area) {
        this.area = area;
    }

    // 抽象类也是类，也可以增加普通方法和属性
    public double getArea() {
        return area;
    }
    protected double area; // 面积
}
class Rect extends Shape {
    private double length;
    private double width;
    Rect(double length,double width){
        super(width);
        this.length = length;
    this.width = width;
    }
    public void draw() {
        System.out.println("矩形：lenth="+length+"width="+width);
    }
    public void calcArea(){
        area = length * width;
    }
}
class Circle extends Shape {
    private double r;
    final private static double PI = 3.14;
    public Circle(double r){
        super(r);
        this.r = r;
    }
    public void draw() {
        System.out.println("圆：r=" +r);
    }
    public void calcArea(){
        area = PI*r*r;
    }
}
//三角形
abstract class Triangle extends Shape{
    private double a;
    private double b;
    private double c;

    public Triangle(double area) {
        super(area);
    }

    @Override
    public void draw() {
        System.out.println("三角形：a="+a+"b="+"c="+c);
    }
}